<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>
        function * gen(){
            console.log(1111)
            yield
            console.log(22222)
            yield
            console.log(333333)
            yield
            console.log(44444)
        }
        let iterator = gen()
        //实际上是一个迭代器，调用next()方法进行调用，且在yield代码中断
        console.log(iterator.next())
        console.log(iterator.next())
        console.log(iterator.next())
        console.log(iterator.next())



    </script>
    
</body>
</html>